package org.jeecg.modules.cosmetic.controller;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.cosmetic.handler.EvaluatorHandler;
import org.jeecg.modules.cosmetic.model.dto.EvaluatorListDTO;
import org.jeecg.modules.cosmetic.model.vo.EvaluatorEditorVO;
import org.jeecg.modules.cosmetic.model.vo.ReqIdVO;
import org.jeecg.modules.cosmetic.utils.MyValidateUtil;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 评估人
 * @Author: jeecg-boot
 * @Date: 2022-06-30
 * @Version: V1.0
 */
@Api(tags = "评估人")
@RestController
@RequestMapping("/api/evaluator")
@Slf4j
public class TEvaluatorController {

    @Resource
    private EvaluatorHandler evaluatorHandler;

    @ApiOperation(value = "评估人-编辑", notes = "评估人-编辑")
    @PostMapping(value = "/editor")
    public Result<?> editor(@RequestBody EvaluatorEditorVO vo) {
        MyValidateUtil.validThrow(vo);
        return evaluatorHandler.evaluatorEditor(vo);
    }

    @ApiOperation(value = "评估人-删除", notes = "评估人-删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestBody ReqIdVO vo) {
        MyValidateUtil.validThrow(vo);
        return evaluatorHandler.deleteEvaluator(vo);
    }

    @ApiOperation(value = "评估人-列表", notes = "评估人-列表")
    @GetMapping(value = "/list")
    public Result<List<EvaluatorListDTO>> list() {
        return evaluatorHandler.queryEvaluatorList();
    }

}
